1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 import java.util.Locale;
30
31 public class Bug4429024 {
32
33 public static void main(String[] args) throws Exception {
34
35 int errors=0;
36
37 String [][] fiLocales = {
38 { "ar", "arabia" },
39 { "ba", "baski" },
40 { "bg", "bulgaria" },
41 { "ca", "katalaani" },
42 { "cs", "tsekki" },
43 { "da", "tanska" },
44 { "de", "saksa" },
45 { "el", "kreikka" },
46 { "en", "englanti" },
47 { "es", "espanja" },
48 { "fi", "suomi" },
49 { "fr", "ranska" },
50 { "he", "heprea" },
51 { "hi", "hindi" },
52 { "it", "italia" },
53 { "ja", "japani" },
54 { "lt", "liettua" },
55 { "lv", "latvia" },
56 { "nl", "hollanti" },
57 { "no", "norja" },
58 { "pl", "puola" },
59 { "pt", "portugali" },
60 { "ru", "ven\u00e4j\u00e4" },
61 { "sv", "ruotsi" },
62 { "th", "thai" },
63 { "tr", "turkki" },
64 { "zh", "kiina" }
65 };
66
67 String[][] fiCountries = {
68 { "BE", "Belgia" },
69 { "BR", "Brasilia" },
70 { "CA", "Kanada" },
71 { "CH", "Sveitsi" },
72 { "CN", "Kiina" },
73 { "CZ", "Tsekin tasavalta" },
74 { "DE", "Saksa" },
75 { "DK", "Tanska" },
76 { "ES", "Espanja" },
77 { "FI", "Suomi" },
78 { "FR", "Ranska" },
79 { "GB", "Iso-Britannia" },
80 { "GR", "Kreikka" },
81 { "IE", "Irlanti" },
82 { "IT", "Italia" },
83 { "JP", "Japani" },
84 { "KR", "Korea" },
85 { "NL", "Alankomaat" },
86 { "NO", "Norja" },
87 { "PL", "Puola" },
88 { "PT", "Portugali" },
89 { "RU", "Ven\u00e4j\u00e4" },
90 { "SE", "Ruotsi" },
91 { "TR", "Turkki" },
92 { "US", "Yhdysvallat" }
93 };
94
95 for (int i=0; i < fiLocales.length; i++) {
96 errors += getLanguage(fiLocales[i][0], fiLocales[i][1]);
97 }
98
99 for (int i=0; i < fiCountries.length; i++) {
100 errors += getCountry(fiCountries[i][0], fiCountries[i][1]);
101 }
102
103 if(errors > 0){
104 throw new RuntimeException();
105 }
106 };
107
108
109 static int getLanguage(String inLang, String localizedName){
110
111 Locale fiLocale = new Locale("fi", "FI");
112 Locale inLocale = new Locale (inLang, "");
113
114 if (!inLocale.getDisplayLanguage(fiLocale).equals(localizedName)){
115 System.out.println("Language " + inLang +" should be \"" + localizedName + "\", not \"" + inLocale.getDisplayLanguage(fiLocale) + "\"");
116 return 1;
117 }
118 else{
119 return 0;
120 }
121 }
122
123 static int getCountry(String inCountry, String localizedName){
124
125 Locale fiLocale = new Locale("fi", "FI");
126 Locale inLocale = new Locale ("", inCountry);
127
128 if (!inLocale.getDisplayCountry(fiLocale).equals(localizedName)){
129 System.out.println("Country " + inCountry + " should be \"" + localizedName + "\", not \"" + inLocale.getDisplayCountry(fiLocale) + "\"");
130 return 1;
131 }
132 else{
133 return 0;
134 }
135
136 }
137 }